﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WebApi
{
   
    public class VerLineConvertString
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="verLineString">1|2|3</param>
        /// <returns>'1','2','3'</returns>
        public static string GetData(string verLineString)
        {
            string str = "";
            List<string> strs = verLineString?.Split("|").ToList();
            strs?.ForEach(x =>
            {
                if (!string.IsNullOrEmpty(x))
                {
                    str += "'" + x + "',";
                }
               
            });
            return str.TrimEnd(',');
        }

        public static List<string> GetListData(string verLineString)
        {
            List<string> list = new List<string>();
            List<string> strs = verLineString?.Split("|").ToList();
            strs?.ForEach(x =>
            {
                if (!string.IsNullOrEmpty(x))
                {
                    list.Add(x);
                }
            });
            return list; ;
        }

    }
}
